<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ajax实现异步</title>
    <script src="js/jquery-3.5.1.js"></script>
    <script>
        function f() {
            alert("------")
            $.ajax({
                url: "hello-servlet",
                type: "get",
                data: {"name": "li"},
                success: function (data) {
                    alert(data)
                }
            })
        }
    </script>
</head>
<body>
<input type="button" value="按钮" id="id1" onclick="f()">
<input>
</body>
</html>